<script setup>
import emitter from '../utils/bus';

function click() {
  emitter.emit('sendDataTo1', { msg: "来自组件2的消息" })
}

</script>

<template>
  <div>
    <h2>组件2</h2>
    <el-button @click="click">发送数据到组件1</el-button>
  </div>
</template>
